package com.bqtv.sport.dialog

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.FrameLayout
import com.bqtv.sport.databinding.DialogGoodsBinding
import com.bqtv.sport.databinding.DialogRedpackageBinding
import com.hjq.base.BaseDialog

class RedPackageDialog {
    class Builder(context: Context) : BaseDialog.Builder<Builder>(context) {
        var binding: DialogRedpackageBinding =
            DialogRedpackageBinding.inflate(LayoutInflater.from(context), FrameLayout(context), false)

        init {
            setContentView(binding.root)
            setData()
        }

        fun setData(): Builder {


            setOnClickListener(binding.ivClose, binding.vOpen)
            return this
        }

        override fun onClick(view: View) {
            super.onClick(view)
            if (view == binding.ivClose) {
                dismiss()
            } else if (view == binding.vOpen) {
                clickResult?.onConfirmClick()
                dismiss()

            }
        }
        var clickResult: ClickResult? = null

        interface ClickResult {
            fun onConfirmClick()
        }
    }
}